package day05;
//break和continue的演示
public class ForDemo {
    public static void main(String[] args) {
        /*for (int num =1;num<=9;num++){
            if (num==4){//在某种特定条件下,提前结束循环
                break;//跳出循环
            }
            System.out.println(num+"*9="+num*9);
        }*/
        /*
        num=1  1*9=9
        num=2  2*9=18
        num=3  3*9=27
        num=4  break跳出循环
         */
        //输出9的乘法表,跳过能被3整除的
        for (int num =1;num<=9;num++){
            if (num%3==0){//1,2,4,5,7,8
                continue;//跳过循环体中剩余语句而进入下一次循环
            }
            System.out.println(num+"*9="+num*9);
        }
        //输出9的乘法表,只要不能被3整除的
        for (int num =1;num<=9;num++){
            if (num%3!=0){//1,2,4,5,7,8
                System.out.println(num+"*9="+num*9);
            }

        }
        //输出9的乘法表,跳过不能被3整除的
        for (int num =1;num<=9;num++){
            if (num%3!=0){//3,6,9
                continue;//跳过循环体中剩余语句而进入下一次循环
            }
            System.out.println(num+"*9="+num*9);
        }














    }
}
